function areaZip(zipID, zipID2,areaID,cityID,townID,api){
	var zip1 = $('#' + zipID).val();
	var zip2 = $('#' + zipID2).val();

	area(zip1 + zip2, areaID,cityID,townID,api);
}

function area(zip, areaID, cityID, townID,api){
		if (!zip){
			alert('郵便番号を入力して下さい');
		}else{
			_areaID = areaID;
			_cityID = cityID;
			_townID = townID;
                         $.ajax({
                        type: "POST",
                        url:api, 
                        data: {zipcode: zip},
                        dataType: "text",  
                        cache:false,
                        success: 
                             function(data){
                                  arrayArea = data.split(',');
                                $('#' + _areaID).val(arrayArea[0]);
                                $('#' + _cityID).val(arrayArea[1]);
                                $('#' + _townID).val(arrayArea[2]);
                              //alert(arrayArea[0]);//as a debugging message.
                             }
                        });
                    }	
}

